package com.estar.assistsurvy.activity;

import com.estar.assistsurvy.controller.ActivityController;
import com.estar.assistsurvy.utils.MightypleUtil;
import com.pgyersdk.update.PgyUpdateManager;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.Toast;
import cn.jpush.android.api.JPushInterface;

public class BaseActivity extends FragmentActivity {


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		if(!MightypleUtil.isConnected(this)){
			showShortToast("当前网络未连接!");		}
		
		ActivityController.addActivity(this);  
        ActivityController.setCurrentActivity(this);  

	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		ActivityController.removeActivity(this); 
	}


	public void showShortToast(String text){
		Toast.makeText(this,text,0).show();
	}

	@SuppressWarnings("unchecked")
	public <T>T find(int id){
		return (T) findViewById(id);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub

		super.onResume();
		JPushInterface.onResume(getApplicationContext());
	}
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub

		super.onPause();
		JPushInterface.onPause(getApplicationContext());
	}
}
